package com.w2cx.selenium.business;

import com.w2cx.selenium.base.DriverBase;
import com.w2cx.selenium.operate.TalentAuthManageOpreate;
import com.w2cx.selenium.page.TalentAuthManagePage;

public class TalentAuthMangeProcess {

    DriverBase driver;
    TalentAuthManageOpreate tamo;
    String selectedUserID = null;
    String firstUserID= null;
    String authStatus = null;



    public TalentAuthMangeProcess(DriverBase driver){
        this.driver = driver;
        tamo = new TalentAuthManageOpreate(driver);
    }


    public void addTalentAuth(String authName,String masterDestinationName){
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //点击运营管理
        tamo.clickOperateManageMenu();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //达人认证管理
        tamo.clickColdBootManageMenu();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //添加达人
        tamo.clickAddTalentBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //认证类型
        tamo.clickAuthCategoryDownlist();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //认证类型选项
        tamo.selectAuthCategoryOption();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //选择
        tamo.clickSelectBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //获得选择的用户ID
        selectedUserID = tamo.getSelectedUserID();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //选择用户
        tamo.clickFirstRadio();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //完成
        tamo.clickOverBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //输入认证称号
        tamo.inputAuthName(authName);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //点击精通目的地
        tamo.clickMasterDestinationInput();


        //输入精通目的地
       tamo.inputMasterDestinationName(masterDestinationName);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //选择一个目的地选项
        tamo.selectDestinationOption();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //选择擅长领域
        tamo.selectFiledCheckBox();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //上传身份证按钮
        tamo.clickUpIDCardImgBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        //上传身份证正面
        tamo.exeUpIDCardImgFrontScript();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        //上传身份证按钮
        tamo.clickUpIDCardImgBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        //上传身份证反面
        tamo.exeUpIDCardImgBehindScript();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        //点击上传封面按钮
        tamo.clickUpCoverImgBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //上传封面图
        tamo.exeUpCoverImgScript();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //确认按钮
        tamo.clickConfirmBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //已添加第一条用户ID
        firstUserID = tamo.getFirstUserID();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }


    //断言
    public boolean addTalentAuthSuccess(){
        if(firstUserID.equals(selectedUserID)){
            return true;
        }else {
            return false;
        }
    }




    //达人认证审核
    public void talentReview(){
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //去审核
        tamo.clickToReviewBtn();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        tamo.clickAuthLevelRadio();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }



        tamo.clickAuthConfirmBtn();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }



        authStatus = tamo.getAuthStatus();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }


    public boolean talentReviewSuccess(){
        if (authStatus.equals("认证通过")){
            return true;
        }else {
            return false;
        }
    }




}
